package principle.inversion.improve;

/**
 * @author shkstart
 * @create ${year}-${month}-${day}-${time}
 */
public class dependencyInversion1 {
    public static void main(String[] args) {
        Person p = new Person();
        p.receive(new Email());
        p.receive(new WeiXin());
    }
}
interface InfoReceiver{
    public String getInfo();
}
class Email implements InfoReceiver{
    public String getInfo(){
        return "电邮信息：fuck world";
    }
}
//增加微信
class WeiXin implements InfoReceiver{
    @Override
    public String getInfo() {
        return "微信消息：shit world";
    }
}
class Person{
    //依赖接口
    public void receive(InfoReceiver receiver){
        System.out.println(receiver.getInfo());
    }
}
